package com.godfrey.configuration;

import com.alibaba.csp.sentinel.adapter.servlet.callback.WebCallbackManager;
import com.godfrey.execption.ExceptionHandler;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;

/**
 * @author godfrey
 * @since 2020-12-26
 */
@Configuration
public class SentinelConfiguration {

    @PostConstruct
    public void init() {
        WebCallbackManager.setRequestOriginParser(new RequestOriginParserDefinition());
    }

    @PostConstruct
    public void init2() {
        WebCallbackManager.setUrlBlockHandler(new ExceptionHandler());
    }
}
